import {
  inject,
  observer,
} from 'mobx-react';


import {
  Row,
  Col,
  Spin,
  Form,
  Modal,
  Table,
  Button,
  message,
} from 'antd'

import {
  WeaTop,
  WeaTab,
  WeaInput,
  WeaScope,
  WeaSelect,
  WeaUpload,
  WeaDialog,
  WeaBrowser,
  WeaFormItem,
  WeaCheckbox,
  WeaNewScroll,
  WeaRightMenu,
  WeaSearchGroup,
  WeaMoreButton,
} from 'ecCom'

import React from 'react'
import * as mobx from 'mobx'
import {
  WeaSwitch
} from 'comsMobx';
import {
  WeaTableNew
} from 'comsMobx';
import {
  WeaLocaleProvider
} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import {
  i18n
} from '../public/i18n';
import '../style/group.css'

const toJS = mobx.toJS;
const WeaTable = WeaTableNew.WeaTable;
const confirm = Modal.confirm;
const FormItem = Form.Item;;

@inject('hrmGroup')

@observer
class Group extends React.Component {
  constructor(props) {
    super(props);
  }

  componentWillMount() {
    const {
      hrmGroup
    } = this.props;
    const {
      form1
    } = hrmGroup;
    let bool = window.location.href.indexOf("/spa/hrm/index_mobx.html") > -1;
    if (bool) {
      document.title = getLabel(81554, '常用组');
      hrmGroup.setWeaTopStatus(true);
    }
    form1.reset();
  }

  componentDidMount() {
    this.init();
  }

  componentWillReceiveProps(nextProps) {
    const {
      hrmGroup
    } = this.props;
    const {
      form1
    } = hrmGroup;

    if (this.props.location.key !== nextProps.location.key) {
      form1.reset();
      this.init();
    }
  }

  componentWillUnmount() {
    const {
      hrmGroup
    } = this.props;
    hrmGroup.showCanceled = false;
  }

  init = () => {
    const {
      hrmGroup
    } = this.props;

    hrmGroup.getPanelForm('1');
    hrmGroup.getTableInfo('1');
    hrmGroup.hasSuggestHint();
  }

  getPanelComponents = (condition, form, arg) => {
    let arr = [];
    let formParams = form.getFormParams();
    const {
      isFormInit
    } = form;

    isFormInit && condition.map(c => {
      c.items.map((field, index) => {
        arr.push(
          <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@ef5r5s@${index}`} span={10} offset={1}>
                  <div style={{marginTop: 20}}>
                    <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@9cep0b@${index}`}
                          label={`${field.label}`}
                          labelCol={{span: `${field.labelcol}`}}
                          wrapperCol={{span: `${field.fieldcol}`}}>
                            {<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@qjhzll@${index}`} fieldConfig={field} form={form} formParams={formParams} />}
                    </WeaFormItem>
                  </div>
            </Col>
        )
      })
    })
    return <div className='hrm-group-datepicker'><Row ecId={`${this && this.props && this.props.ecId || ''}_Row@6xexc6`}
      onKeyDown={(e) =>( e.keyCode == 13 && e.target.tagName === "INPUT")  &&  hrmGroup.getTableInfo(arg === "3" ? "7" : arg)}
    >{arr}</Row></div>
  }

  getNewAndShareComponents = (condition, form, isLinkage) => {
    let arr = [];
    let formParams = form.getFormParams();

    const {
      isFormInit
    } = form;

    isFormInit && condition.map(c => {
      let items = c.items;
      for (let i = 0; i < items.length; i++) {
        let field = items[i];
        let dom;

        if (isLinkage && this.fieldFilter(field)) continue;
        if (isLinkage) {
          dom = this.getShareDom(field, form, formParams);
        } else {
          dom = <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@kyac6k@${i}`} fieldConfig={field} form={form} formParams={formParams} />;
        }

        arr.push(
          <div style={{marginTop: 15}} className='hrm-group-browser'>
  						<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@qlc4dv@${i}`}>
  							<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@4v8t63@${i}`} span={18} offset={3}>
                        		<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@1s7gyv@${i}`}
                        		  label={ (field.domkey[0] !== 'alllevel' && field.domkey[0] !== 'rolelevel') ? `${field.label}` : ''}
                        		  labelCol={{span: 7}}
                        		  wrapperCol={{span: 14}}
                              error={form.getError(field)}
                              tipPosition="bottom" 
                              colon={ (field.domkey[0] !== 'alllevel' && field.domkey[0] !== 'rolelevel') ? true : false}
                            >
                        		    {dom}
                        		</WeaFormItem>
                     		</Col>
  						</Row>
  					</div>
        )
      }
    })

    return <div style={{padding: '25px 0 40px 0', position: 'relative'}}>{arr}</div>
  }

  fieldFilter = (field) => {
    const {
      hrmGroup
    } = this.props;
    const {
      form6
    } = hrmGroup;
    let sharetype;
    let jobtitlelevel;
    let formParams = form6.getFormParams();
    if (formParams.sharetype) sharetype = formParams.sharetype;
    if (formParams.jobtitlelevel) jobtitlelevel = formParams.jobtitlelevel;

    let domkey = (field.domkey)[0];
    if (sharetype == '1' && (domkey == 'sbid' || domkey == 'did' || domkey == 'rid' || domkey == 'rolelevel' || domkey == 'jobtitle' || domkey == 'jobtitlelevel' || domkey == 'seclevel' || domkey == 'jobtitledepartment' || domkey == 'jobtitlesubcompany' || domkey == 'customid' || domkey == 'alllevel')) return true;
    if (sharetype == '2' && (domkey == 'rsid' || domkey == 'did' || domkey == 'rid' || domkey == 'rolelevel' || domkey == 'jobtitle' || domkey == 'jobtitlelevel' || domkey == 'jobtitledepartment' || domkey == 'jobtitlesubcompany' || domkey == 'customid')) return true;
    if (sharetype == '3' && (domkey == 'rsid' || domkey == 'sbid' || domkey == 'rid' || domkey == 'rolelevel' || domkey == 'jobtitle' || domkey == 'jobtitlelevel' || domkey == 'jobtitledepartment' || domkey == 'jobtitlesubcompany' || domkey == 'customid')) return true;
    if (sharetype == '4' && (domkey == 'rsid' || domkey == 'sbid' || domkey == 'did' || domkey == 'jobtitle' || domkey == 'jobtitlelevel' || domkey == 'jobtitledepartment' || domkey == 'jobtitlesubcompany' || domkey == 'customid' || domkey == 'alllevel')) return true;
    if ((sharetype == '7' && (jobtitlelevel == '0' || !jobtitlelevel)) && (domkey == 'rsid' || domkey == 'sbid' || domkey == 'did' || domkey == 'rid' || domkey == 'rolelevel' || domkey == 'seclevel' || domkey == 'jobtitledepartment' || domkey == 'jobtitlesubcompany' || domkey == 'customid' || domkey == 'alllevel')) return true;
    if ((sharetype == '7' && jobtitlelevel == '1') && (domkey == 'rsid' || domkey == 'sbid' || domkey == 'did' || domkey == 'rid' || domkey == 'rolelevel' || domkey == 'seclevel' || domkey == 'jobtitlesubcompany' || domkey == 'customid' || domkey == 'alllevel')) return true;
    if ((sharetype == '7' && jobtitlelevel == '2') && (domkey == 'rsid' || domkey == 'sbid' || domkey == 'did' || domkey == 'rid' || domkey == 'rolelevel' || domkey == 'seclevel' || domkey == 'jobtitledepartment' || domkey == 'customid' || domkey == 'alllevel')) return true;
    if (sharetype == '8' && (domkey == 'sbid' || domkey == 'rsid' || domkey == 'did' || domkey == 'rid' || domkey == 'rolelevel' || domkey == 'jobtitle' || domkey == 'jobtitlelevel' || domkey == 'jobtitledepartment' || domkey == 'jobtitlesubcompany' || domkey == 'alllevel')) return true;
    if (sharetype == '5' && (domkey == 'sbid' || domkey == 'rsid' || domkey == 'did' || domkey == 'rid' || domkey == 'rolelevel' || domkey == 'jobtitle' || domkey == 'jobtitlelevel' || domkey == 'jobtitledepartment' || domkey == 'jobtitlesubcompany' || domkey == 'customid' || domkey == 'alllevel')) return true;

  }

  getShareDom = (field, form, formParams) => {
    const {
      hrmGroup
    } = this.props;
    const {
      checkBoxVal,
      selectvalue,
      scopeValue
    } = hrmGroup;
    let dom;
    const options = [{
      key: '1',
      selected: true,
      showname: getLabel('27511', "部门")
    }, {
      key: '2',
      showname: getLabel('33553', "分部")
    }, {
      key: '3',
      showname: getLabel('140', "总部")
    }]

    if (field.domkey[0] == 'alllevel') {
      dom = (<div style={{position: 'absolute', top: -88, right: -90}} className='hrm-group-wcb'>
                    <WeaCheckbox ecId={`${this && this.props && this.props.ecId || ''}_WeaCheckbox@1a4afz`} value={checkBoxVal} onChange={(val) => hrmGroup.setCheckBoxVal(val)}/>
                    <span style={{ marginLeft: 10 }}>{getLabel('125963',"含下级")}</span>
                  </div>);
    } else if (field.domkey[0] == 'rolelevel') {
      dom = (<div style={{position: 'absolute', top: -95, right: -125}}>
                    <span style={{float: 'left', marginTop: 6}}>{i18n.label.level()}</span>
                    <div style={{float: 'left'}}>
                      <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@je0w8d`} 
                        value={selectvalue}
                        options={options}
                        onChange={val => hrmGroup.setSelectValue(val)}
                      />
                    </div>
                </div>);
    } else if (field.domkey[0] == 'seclevel') {
      dom = <WeaScope ecId={`${this && this.props && this.props.ecId || ''}_WeaScope@dg8azk`}
                  isMobx
                  viewAttr={3}
                  value={scopeValue}
                  onChange={val => hrmGroup.setScopeValue(val)}
                />
    } else {
      dom = <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@4ld5if`} fieldConfig={field} form={form} formParams={formParams} />
    }

    return dom;
  }

  getImportComponents = (condition, form, arg) => {
    let _arr = [];
    const {
      isFormInit
    } = form;

    isFormInit && condition.map((c, i) => {
      let arr = [];
      c.items.map((field, index) => {
        if (field.domkey) {
          let dom = this.getDOM(field, arg);

          arr.push({
            com: (
              <div className='hrm-group-import  hrm-group-import-item'>
                  		  		<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@jm4oym@${index}`}>
                  		    		<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@yi3ivt@${index}`} span={2} offset={4}>
                                <div className='hrm-group-box'>
                                  <div className='hrm-group-circle hrm-group-radius' style={{marginTop: 20}}>{index + 1}</div>
                                </div>
                              </Col>
                  		    		<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@dm9f94@${index}`} span={14}>
                  		    		  <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@rggepz@${index}`}
                  		    		    label={`${field.label}`}
                  		    		    labelCol={{span: `${field.labelcol}`}}
                  		    		    wrapperCol={ (arg == '2' && index == 2) ?  {span: 24 - `${field.labelcol}`} : {span: `${field.fieldcol}`}}
                                  style={{margin:'5px 0'}}
                                  >
                  		    		      {dom}
                                    { field.domkey[0] == 'importlx' && this.getImportTypeValue() ? (<div style={{position: 'absolute', top: 0, right: -145, color: '#4D7AD8'}}>{getLabel('131396',"覆盖时将替换原人员列表")}</div>) : '' }
                  		    		  </WeaFormItem>
                  		    		</Col>
                  		  		</Row>
                  			</div>
            ),
            colSpan: 1,
          })
        }

        if (!field.domkey) {
          let dom = this.getParagraph(field, arg);

          arr.push({
            com: (<div style={{marginTop: 15}}>{dom}</div>),
            colSpan: 1
          })
        }
      })
      _arr.push(<div style={{color: '#666666', position: 'relative'}}><WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@1p6ayi@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={arr} col={1} fontSize={13}/></div>)
    })
    return _arr;
  }

  getDOM = (field, arg) => {
    const {
      hrmGroup
    } = this.props;
    const {
      excelfile,
      list,
      upStatus,
      form4,
      form5
    } = hrmGroup;
    let dom;
    let form;
    if (arg == '1') form = form4;
    if (arg == '2') form = form5;
    let formParams = form.getFormParams();

    if (field.domkey[0] == 'templet') {
      let link;
      let arr = field.value.split(';');
      if (formParams.keyField == 'workcode') link = arr[0];
      if (formParams.keyField == 'loginid') link = arr[1];
      if (formParams.keyField == 'lastname') link = arr[2];
      dom = <a href={link} className='hrm-group-linkStyle'>{getLabel('386488',"常用组信息导入模板")}</a>
    } else if (field.domkey[0] == 'excelfile') {
      dom = (<div>
            			<div>
            				<WeaUpload ecId={`${this && this.props && this.props.ecId || ''}_WeaUpload@2tcc3u`}
       			  				uploadUrl='/api/doc/upload/uploadFile'
       			  				category='string'
       			  				limitType='xls'
       			  				datas={upStatus === 'uploaded'  ? list : []}
       			  				onChange={(id, l) => {hrmGroup.setExcelfile(id[0]); hrmGroup.setList(l); hrmGroup.updateFormFields( (parseInt(arg) + 2).toString(), id[0])}}
       			  				onUploading={s => this.onUploading(s)}
       						>
       			  				<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ye1i2d`}>{getLabel('125333',"选择文件")}</Button>
       						</WeaUpload>
            			</div>
            			<div style={{marginTop: -30,marginLeft: 90}}>
            				{ list.length == 0 ? <p>{getLabel('384040',"未选择任何文件")}</p> : list.map(file => <p>{file.filename}</p>) }
            			</div>
      				</div>)
    } else {
      dom = (<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@ym1oed`} fieldConfig={field} form={form} formParams={formParams} />)
    }
    return dom;
  }

  getImportTypeValue = () => {
    const {
      hrmGroup
    } = this.props;
    const {
      form5
    } = hrmGroup;

    let formParams = form5.getFormParams();
    if (formParams.importlx == 'update') {
      return true;
    } else {
      return false;
    }
  }

  getParagraph = (field, arg) => {
    const {
      hrmGroup
    } = this.props;
    const {
      form4,
      form5
    } = hrmGroup;
    let dom;
    let form;
    if (arg == '1') form = form4;
    if (arg == '2') form = form5;
    let formParams = form.getFormParams();

    if (field.index == '1') {
      let link;
      let arr;
      if (field.link) {
        arr = field.link.split(';');
        if (formParams.keyField == 'workcode') link = arr[0];
        if (formParams.keyField == 'loginid') link = arr[1];
      }
      dom = (<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@d54bnb`}>
                      	<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@uyo71h`} span={2} offset={4}>
                          <div className='hrm-group-box'>
                            <div className='hrm-group-circle hrm-group-radius'>{field.index}</div>
                          </div>
                        </Col>
                      	<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@gnqig0`} span={14}>{ (arg == '1') ? <p><span>{field.value + ': '}</span><a href={link} className='hrm-group-linkStyle'>{getLabel('386488',"常用组信息导入模板")}</a></p> : <p>{field.value}</p>}</Col>
                    </Row>)
    } else {
      dom = (<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@drmuuc`}>
           					<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@tyenw2`} span={2} offset={4}>
                      <div className='hrm-group-box'>
                        <div className='hrm-group-circle hrm-group-radius'>{field.index}</div>
                      </div>
                    </Col>
           					<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@87wgft`} span={14}><p>{field.value}</p></Col>
          		    </Row>)
    }
    return dom;
  }

  onUploading = (s) => {
    const {
      hrmGroup
    } = this.props;
    const {
      list
    } = hrmGroup;
    hrmGroup.setUpStatus(s);
    if (s == 'uploading') {
      hrmGroup.setList([]);
    } else {
      hrmGroup.setList(list);
    }
  }

  changeShowAll = (arg) => {
    const {
      hrmGroup
    } = this.props;
    const {
      showCanceled
    } = hrmGroup;

    if (arg !="1") {
      return 
    }

    return (
        <i style={{position: 'absolute', right: '92%', top: 0}}>
        <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@kqljtk`} size="small" style={{width:26, height: 26, paddingLeft:6 }} onClick={() => hrmGroup.changeShowAll()} title={showCanceled ?getLabel(517080, '显示封存常用组'): getLabel(517081, '不显示封存常用组')}>
        <span>{showCanceled ?
          <i className='icon-coms02-icon-Classified-view' style={{ color: '#2DB7F5' }} /> : <i className='icon-coms02-Seal' style={{ color: '#8A8A8A' }} />}</span>
      </Button>
        </i>
    )
}

  getSuggestIcon = (arg) => {
    const {
      hrmGroup
    } = this.props;
    const {
      hasTrumpet,
      hasHint
    } = hrmGroup;

    if (arg !== '1') {
      return false;
    }
    return (
      <i style={{position: 'absolute', right: '101%', top: 5}}>
  				{hasTrumpet ? <img src='/hrm/hrm_e9/image/u30775.png' alt='' onClick={() => hrmGroup.setSuggestDialogStatus(true)} style={{cursor: 'pointer'}}/> : ''}
  				{hasHint ? <img src='/hrm/hrm_e9/image/u30777.png' alt='' style={{cursor: 'pointer',position: 'absolute', left: 15, top: 8}} /> : ''}
  			</i>
    )
  }

  getImportIcon = (arg) => {
    if (arg == '3' || arg == '4') {
      return false;
    }
    return (
      <i 
               	className="icon-coms-download2 hrm-group-clickicon"
               	title={i18n.button.import()}
               	onClick={() => this.handleImportClick(arg) }
            />
    )
  }

  getAddIcon = (arg) => {
    const {
      hrmGroup
    } = this.props;

    if (arg == '1' || arg == '3') {
      return (
        <i
            	  className="icon-coms-plus hrm-group-clickicon"
            	  title={i18n.button.create()}
            	  onClick={() => {arg == '3' ? hrmGroup.getForm((parseInt(arg) + 2).toString()) : hrmGroup.getForm(arg)}} 
            />
      )
    }
    if (arg == '2') {
      return (
        <div style={{display: 'inline'}}>
                	<WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@45k0r1`}
                      ref='weabrowser'
                	  	type={17}
                	  	title={getLabel('30042',"人员")}
               	  		customized={true}
                	  	hasAdvanceSerach={true}
                	  	isSingle={false}
                	  	onChange={(...args) => {hrmGroup.setMemberId(args[0]); hrmGroup.save('3')}}
                	>
                  		<i
                  		  style={{backgroundColor:'#34A2FF',padding:4,color:'#FFFFFF'}}
                  		  className="icon-coms-plus"
                  		  title={i18n.button.add()}
                  		/>
                	</WeaBrowser>
            	</div>
      )
    }
  }

  getBatchDeleteIcon = (arg) => {
    const {
      hrmGroup
    } = this.props;

    if (arg == '4') {
      return false;
    }
    let len;
    if (arg == '1') len = hrmGroup.tableStore1.selectedRowKeys.length;
    if (arg == '2') len = hrmGroup.tableStore2.selectedRowKeys.length;
    if (arg == '3') len = hrmGroup.tableStore3.selectedRowKeys.length;

    return (
      <i
          style={(len > 0) ? {marginRight: 16,  backgroundColor:'#34A2FF'} : {marginRight: 16,  backgroundColor:'#D9D9D9'}}
          className="icon-coms-Loss hrm-group-clickicon"
          title={i18n.button.multiDelete()}
          onClick={() => (len > 0) && this.handleBatchDelete(arg)} 
        />
    )
  }

  getAuthorityIcon = () => {
    return (
      <div style={{paddingTop: 200, textAlign: 'center', color: '#666'}}>
          <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@6d52vb`}>
            <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@3fg0vi`} span={10} offset={7}>
              <img src='/hrm/hrm_e9/image/noauthority.png' alt='' />
            </Col>
          </Row>
          <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@zvbkx3`}>
            <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@cdd552`} span={10} offset={7}>
              <p>{i18n.message.authFailed()}</p>
            </Col>
          </Row>
        </div>
    )
  }

  handleImportClick = (arg) => {
    const {
      hrmGroup
    } = this.props;

    if (arg == '1') {
      hrmGroup.getForm('3');
    }
    if (arg == '2') {
      hrmGroup.getForm('4');
    }
  }

  handleBatchDelete = (arg) => {
    const {
      hrmGroup
    } = this.props;
    const {
      tableStore1,
      tableStore2,
      tableStore3
    } = hrmGroup;

    let store;
    if (arg == '1') store = tableStore1;
    if (arg == '2') store = tableStore2;
    if (arg == '3') store = tableStore3;

    let srk = this.getSelectedRow(toJS(store));
    this.doDel(srk, arg);
  }

  getSelectedRow = (store) => {
    return store.selectedRowKeys;
  }

  handleSearch = (arg) => {
    const {
      hrmGroup
    } = this.props;
    if (arg == '1') {
      hrmGroup.getTableInfo('1');
      hrmGroup.setPanelOneStatus(false);
    }
    if (arg == '2') {
      hrmGroup.getTableInfo('2');
      hrmGroup.setPanelTwoStatus(false);
    }
    if (arg == '3') {
      hrmGroup.getTableInfo('7');
      hrmGroup.setPanelThreeStatus(false);
    }
  }

  handleSubmit = (arg) => {
    const {
      hrmGroup
    } = this.props;
    const {
      excelfile
    } = hrmGroup;
    if (excelfile == '') {
      message.warning(i18n.message.pleaseUploadFile());
      return false;
    }
    if (arg == '1') {
      hrmGroup.setImportInfoDialogStatus(true);
      hrmGroup.save('5');
    }
    if (arg == '2') {
      hrmGroup.setImportMemInfoDialogStatus(true);
      hrmGroup.save('6');
    }
  }

  handleImportHistory = () => {
    const {
      hrmGroup
    } = this.props;
    hrmGroup.setImportHistoryDialogStatus(true);
    hrmGroup.getTableInfo('5');
  }


  handleOneDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;
    if (key == '0') this.handleImportClick('1');
    if (key == '1') hrmGroup.getForm('1');
    if (key == '2') this.handleBatchDelete('1');
  }

  handleTwoDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;
    if (key == '3') hrmGroup.save('1');
    if (key == '4') hrmGroup.save('2');
  }

  handleThreeDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;
    if (key == '5') this.handleSubmit('1');
    if (key == '6') this.handleImportHistory();
  }

  handleFourDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;
    if (key == '5') this.handleSubmit('2');
    if (key == '7') {};
  }

  handleFiveDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;
    if (key == '3') hrmGroup.save('4');
    if (key == '7') {};
  }

  handleSixDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;
    hrmGroup.setSuggestDialogStatus(false);
  }

  handleSevenDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;

    if (key == '0') this.handleImportClick('2');
    if (key == '1') this.refs.weabrowser.openModal();
    if (key == '2') this.handleBatchDelete('2');
  }

  handleEightDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;
    if (key == '1') hrmGroup.getForm('5');
    if (key == '2') this.handleBatchDelete('3');
  }

  handleNineDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;
    if (key == '3') hrmGroup.save('9');
    if (key == '7') {};
  }

  handleDropMenuClick = (key) => {
    const {
      hrmGroup
    } = this.props;
    const {
      editTabKey
    } = hrmGroup;

    if (editTabKey == '0') this.handleNineDropMenuClick(key);
    if (editTabKey == '1') this.handleSevenDropMenuClick(key);
    if (editTabKey == '2') this.handleEightDropMenuClick(key);
  }

  getTable = (params) => {
    let tableStore = params.tableStore;
    let loading = params.loading;
    let title = params.title;
    let customComponent = params.customComponent;
    let isNeedScroll = params.isNeedScroll;
    let isNeedRerender = params.isNeedRerender;
    let tag = params.tag;
    let height = params.height;
    let isNeedSearchGroup = params.isNeedSearchGroup;

    const tbProps = {};
    isNeedRerender && Object.assign(tbProps, {getColumns: this.reRenderColumns});
    switch(tag){
      case 'base':
        Object.assign(tbProps, {onOperatesClick: this.onOperatesClick1});
        break;
      case 'member':
        Object.assign(tbProps, {onOperatesClick: this.onOperatesClick2});
        break;
      case 'share':
        Object.assign(tbProps, {onOperatesClick: this.onOperatesClick3});
        break;
      case 'suggest':
        Object.assign(tbProps, {onOperatesClick: this.onOperatesClick4});
        break;
    }

    if (isNeedSearchGroup) {
      if (isNeedScroll) {
        return (
          <div className='hrm-group-table hrm-group-form'>
                <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@4hy1go`} 
                  comsWeaTableStore={tableStore}
                  hasOrder={true}
                  needScroll={isNeedScroll}
                  {...tbProps}
                />
          </div>
        )
      } else {
        return (
          <div className='hrm-group-table hrm-group-form'>
              <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@js2hls`} 
                  comsWeaTableStore={tableStore}
                  hasOrder={true}
                  {...tbProps}
                  scroll={{y: height-130}} 
              />
          </div>
        )
      }
    } else {
      return (
        <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@96fxs5`} 
            comsWeaTableStore={tableStore}
            hasOrder={true}
            scroll={{y: height-130}} 
            {...tbProps}
        />
      )
    }
  }

  getAntTable = (params, isWrapBySearchgroup) => {
    let col = params.col;
    let ds = params.ds;
    let loading = params.loading;
    let isPagination = params.isPagination;
    let action = params.action;
    let num = params.num;
    let height;

    if (isWrapBySearchgroup) {
      height = params.height - 85;
    } else {
      height = params.height - 48;
    }

    if (col.length > 0 && !this.isEmptyObject(action)) {
      col[num].render = (text, record) => (
        <span>
            	  <a href={'/api/hrm/group/getImportHistoryFile?filename=' + this.getNumFromString(record.fileName)}>{action.download}</a>
            	  <span className="ant-divider" />
            	  <a onClick={() => this.delImportHistory(record)}>{action.delete}</a>
            	</span>
      );
      return (
        <div className='hrm-group-antTable'>
            <Table ecId={`${this && this.props && this.props.ecId || ''}_Table@7cw2sk`} 
              columns={col} 
              dataSource={ds} 
              loading={loading}
              pagination={isPagination}
              scroll={{ y: height}}
            />
          </div>
      )

    }
    return (
      <div className='hrm-group-antable'>
          <Table ecId={`${this && this.props && this.props.ecId || ''}_Table@dsz528`} 
            columns={col} 
            dataSource={ds} 
            loading={loading}
            pagination={isPagination}
            scroll={{ y: height}}
          />
        </div>
    )
  }


  delImportHistory = (record) => {
    const {
      hrmGroup
    } = this.props;
    const {
      dataSource
    } = hrmGroup;

    let num = this.getNumFromString(record.fileName);
    hrmGroup.setDelFileNum(num);
    let index = this.getRowIndex(record.key, toJS(dataSource));
    this.showConfirm('4', [], index);
  }

  getNumFromString = (str) => {
    return str.replace(/[^0-9]+/g, '');
  }

  getRowIndex = (key, dataSource) => {
    let arr = [];
    if (dataSource instanceof Array) {
      for (let i = 0; i < dataSource.length; i++) {
        arr.push(dataSource[i].key);
      }
    }
    return arr.indexOf(key);
  }

  reRenderColumns = (columns, isNeedRerender) => {
    const {
      hrmGroup
    } = this.props;
    let _this = this;
    if (isNeedRerender) {
      columns.forEach((c, index) => {
        let obj = {};
        if (c.dataIndex == 'name') {
          c.render = function(text, record) {
            let rowData = toJS(record);
            let id;
            if (rowData.id) id = rowData.id;
            if (rowData.groupid) id = rowData.groupid;
            return <a onClick={ () => _this.rowDataClick(id) } dangerouslySetInnerHTML={{__html:rowData.namespan}}></a>
          }
        } else if (c.dataIndex == 'result') {
          c.render = function(text, record) {
            let rowData = toJS(record);
            return <a onClick={ () => { hrmGroup.setGroupId(rowData.id); hrmGroup.getForm('2'); hrmGroup.tabClick('1');} } dangerouslySetInnerHTML={{__html: record.resultspan}} ></a>
          }
        } else if (c.dataIndex == 'dsporder') {
          c.render = function(text, record) {
            let rowData = toJS(record);
            if (rowData.dsporder < 0) {
              rowData.dsporder = 1;
            }
            return (
              <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@a2fm6z`} 
                          value={rowData.dsporder} 
                          onBlur={ (val) =>  hrmGroup.setDsporderArr(val, rowData)} 
                        />
            )
          }
        } else {
          c.render = function(text, record) {
            let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex];
            return <span dangerouslySetInnerHTML={{__html: valueSpan}}></span>
          }
        }
      })
    }
    return columns;
  }

  rowDataClick = (id) => {
    const {
      hrmGroup
    } = this.props;

    hrmGroup.setGroupId(id);
    hrmGroup.getForm('2');
    hrmGroup.tabClick('0');
  }

  doCancel = (id) => {
    const {
      hrmGroup
    } = this.props;

    hrmGroup.doCancel({
      id
    });
  }

  doISCanceled = (id) => {
    const {
      hrmGroup
    } = this.props;

    hrmGroup.doISCanceled({
      id
    });
  }

  onOperatesClick1 = (record, index, operate) => {
    const {
      hrmGroup
    } = this.props;
    let funcIndex = operate.index;
    const func = operate.href ? operate.href.split(':')[1].split('(')[0] : '';
    hrmGroup.setGroupId(record.id);

    if (funcIndex == '0') hrmGroup.tabClick('0');
    if (funcIndex == '1') hrmGroup.tabClick('1');
    if (funcIndex == '2') hrmGroup.tabClick('2');
    if (funcIndex == '0' || funcIndex == '1' || funcIndex == '2') {
      hrmGroup.getForm('2');
    }
    if (func == 'doDel') this.doDel([], '1');
    if(func=='doCancel'||func=='doISCanceled'){
      hrmGroup[func] && hrmGroup[func]({id:record.id});
    }
  }

  onOperatesClick2 = (record, index, operate) => {
    const {
      hrmGroup
    } = this.props;
    let funcIndex = operate.index;
    hrmGroup.setMemberId(record.id);
    if (funcIndex == '0') this.doDel([], '2');
  }

  onOperatesClick3 = (record, index, operate) => {
    const {
      hrmGroup
    } = this.props;
    let funcIndex = operate.index;
    hrmGroup.setTypeId(record.id);
    hrmGroup.getTableInfo('3');
    if (funcIndex == '0') this.doDel([], '3');
  }

  onOperatesClick4 = (record, index, operate) => {
    const {
      hrmGroup
    } = this.props;
    let funcIndex = operate.index;
    hrmGroup.setSuggestId(record.randomFieldId);
    if (funcIndex == '0') {
      hrmGroup.save('7');
    }
    if (funcIndex == '1') {
      hrmGroup.delete('5');
    }
    if (funcIndex == '2') {
      hrmGroup.save('8');
    }
  }

  doDel = (arr, arg) =>{
    const {
      hrmGroup
    } = this.props;

    if (arg == '1') {
      this.showConfirm('1', arr);
    }
    if (arg == '2') {
      this.showConfirm('2', arr);
    }
    if (arg == '3') {
      this.showConfirm('3', arr);
    }
  }

  getCustomComponent = (arg) => {
    const {
      hrmGroup
    } = this.props;

    return (
      [
        this.changeShowAll(arg),
        this.getSuggestIcon(arg),
        this.getImportIcon(arg),
        this.getAddIcon(arg),
        this.getBatchDeleteIcon(arg)
      ]
    )
  }

  showConfirm = (arg, arr, index) => {
    let _this = this;
    confirm({
      title: i18n.confirm.defaultTitle(),
      content: arr.length == 0 ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
      okText: i18n.button.ok(),
      cancelText: i18n.button.cancel(),
      onOk() {
        _this.ok(arg, arr, index);
      },
      onCancel() {
        return false;
      },
    });
  }

  ok = (arg, arr, index) => {
    const {
      hrmGroup
    } = this.props;
    const {
      dataSource
    } = hrmGroup;

    if (arr.length !== 0) {
      for (let i = 0; i < arr.length; i++) {
        if (arg == '1') hrmGroup.setGroupId(arr[i]);
        if (arg == '2') hrmGroup.setMemberId(arr[i]);
        if (arg == '3') hrmGroup.setTypeId(arr[i]);
        hrmGroup.delete(arg, 'batch');
        if (i == (arr.length - 1)) hrmGroup.delete(arg, 'batch', 'last');
      }
    } else {
      if (arg == '4') dataSource.splice(index, 1);
      hrmGroup.delete(arg);
    }
  }

  isEmptyObject = (obj) => {
    for (let key in obj) {
      return false;
    }
    return true;
  }

  getGroupSettingBtns = (key) => {
    let btns;

    if (key == '0') {
      btns = [];
    } else if (key == '1') {
      btns = this.getCustomComponent('2');
    } else if (key == '2') {
      btns = this.getCustomComponent('3');
    }
    return btns;
  }


  render() {
    const {
      hrmGroup
    } = this.props;
    const {
      isSuggestDialogShow,
      isPanelOneShow,
      isPanelTwoShow,
      isPanelThreeShow,
      isNewDialogShow,
      isEditDialogShow,
      isImportBaseDialogShow,
      isImportMemberDialogShow,
      isShareDialogShow,
      isImportInfoDialogShow,
      isImportHistoryDialogShow,
      isImportMemInfoDialogShow
    } = hrmGroup;
    const {
      form1,
      form2,
      form3,
      form4,
      form5,
      form6,
      form7
    } = hrmGroup;
    const {
      tableStore1,
      tableStore2,
      tableStore3,
      tableStore4
    } = hrmGroup;
    const {
      editTabKey,
      suggestTabKey
    } = hrmGroup;
    const {
      columns,
      dataSource,
      loading,
      action,
      logFilePath,
      height
    } = hrmGroup;
    const {
      condition1,
      condition2,
      condition3,
      condition4,
      condition5,
      condition6,
      condition7
    } = hrmGroup;
    const {
      orderArr,
      hasWeaTop,
      hasAuthority
    } = hrmGroup;

    let searchsBaseValue1 = form1.getFormParams().name;
    let searchsBaseValue2 = form2.getFormParams().resourcename;
    let searchsBaseValue3 = form7.getFormParams().suggesttitle;
    let type = form3.getFormParams().type;

    let tbParams1 = {
      tableStore: tableStore1,
      loading: tableStore1.loading,
      title: getLabel('386490', "常用组列表"),
      customComponent: this.getCustomComponent('1'),
      isNeedScroll: true,
      isNeedRerender: true,
      isNeedSearchGroup: true,
      tag: 'base',
    }

    let tbParams2 = {
      tableStore: tableStore2,
      loading: tableStore2.loading,
      title: getLabel('386491', "成员列表"),
      customComponent: this.getCustomComponent('2'),
      height: height,
      isNeedRerender: true,
      isNeedSearchGroup: true,
      tag: 'member',
    }

    let tbParams3 = {
      tableStore: tableStore3,
      loading: tableStore3.loading,
      title: getLabel('386492', "共享范围列表"),
      customComponent: this.getCustomComponent('3'),
      height: height,
      isNeedRerender: false,
      isNeedSearchGroup: true,
      tag: 'share',
    }

    let tbParams4 = {
      tableStore: tableStore4,
      loading: tableStore4.loading,
      height: height,
      isNeedRerender: true,
      isNeedSearchGroup: false,
      tag: 'suggest',
    }

    let paramsForAntTable = {
      col: columns,
      ds: dataSource,
      loading: loading,
      isPagination: false,
      action: action,
      height: height,
      num: 2,
    }

    const tabName = [{
      key: '0',
      title: getLabel('81711', "基本信息")
    }, {
      key: '1',
      title: getLabel('431', "成员")
    }, {
      key: '2',
      title: getLabel('82752', "共享范围")
    }, {
      key: '3',
      title: getLabel('16349', "待处理")
    }, {
      key: '4',
      title: getLabel('1454', "已处理")
    }, ]

    const dropMenuDatas = [{
      key: '0',
      content: i18n.button.import(),
      icon: <i className='icon-coms-download2' />
    }, {
      key: '1',
      content: i18n.button.add(),
      icon: <i className='icon-coms-New-Flow' />
    }, {
      key: '2',
      content: i18n.button.multiDelete(),
      icon: <i className='icon-coms-delete' />
    }, {
      key: '3',
      content: i18n.button.save(),
      icon: <i className='icon-coms-Preservation' />
    }, {
      key: '4',
      content: i18n.button.saveAndSetting(),
      icon: <i className='icon-coms-Flow-setting' />
    }, {
      key: '5',
      content: i18n.button.submit(),
      icon: <i className='icon-coms-export' />
    }, {
      key: '6',
      content: i18n.button.importHistoryQuery(),
      icon: <i className='icon-coms-Print-log' />
    }]

    const dropMenuDatas1 = dropMenuDatas.slice(0, 3);
    const dropMenuDatas2 = dropMenuDatas.slice(3, 5).concat(dropMenuDatas.slice(7, 8));
    const dropMenuDatas3 = dropMenuDatas.slice(5, 7).concat(dropMenuDatas.slice(7, 8));
    const dropMenuDatas4 = dropMenuDatas.slice(5, 6).concat(dropMenuDatas.slice(7, 8));
    const dropMenuDatas5 = dropMenuDatas.slice(3, 4).concat(dropMenuDatas.slice(7, 8));
    const dropMenuDatas6 = dropMenuDatas.slice(7, 8);
    const dropMenuDatas7 = dropMenuDatas.slice(1, 3);

    const btn1 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@c2yqhk@1`} type="primary" onClick={() => this.handleSearch('1')}>{i18n.button.search()}</Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@q36u6a@2`} type="primary" onClick={() => form1.reset()}>{i18n.button.reset()}</Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@h3u4pb@3`} type="primary" onClick={() => hrmGroup.setPanelOneStatus(false)}>{i18n.button.cancel()}</Button>),
    ];

    const btn2 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@w9xv9r@1`} type="primary" onClick={() => hrmGroup.save('1')}>{i18n.button.save()}</Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ry3viy@2`} type="primary" onClick={() => hrmGroup.save('2')}>{i18n.button.saveAndSetting()}</Button>),
      // (<WeaMoreButton />)
    ]

    const btn = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@3t1xs2@1`} type="primary" onClick={() => hrmGroup.save('9')}>{i18n.button.save()}</Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@a9e5o3@2`} type="primary" onClick={() => hrmGroup.save('10')}>{i18n.button.save()}</Button>),
      // (<WeaMoreButton />)
    ]

    let btn3;
    let datas;
    if (editTabKey == '0') {
      btn3 = btn.slice(0, 1).concat(btn.slice(2, 3));
      datas = dropMenuDatas5;
    }

    if (editTabKey == '1') {
      btn3 = btn.slice(1, 2).concat(btn.slice(2, 3));
      datas = dropMenuDatas1;
    }

    if (editTabKey == '2') {
      btn3 = btn.slice(2, 3);
      datas = dropMenuDatas7;
    }

    const btn4 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5hka8z@1`} type="primary" onClick={() => this.handleSearch('2')}>{i18n.button.search()}</Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@2u9i5q@2`} type="primary" onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@t5qqfo@3`} type="primary" onClick={() => hrmGroup.setPanelTwoStatus(false)}>{i18n.button.cancel()}</Button>),
    ];

    const btn5 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@vif8v5@1`} type="primary" onClick={() => this.handleSubmit('1')}>{i18n.button.submit()}</Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@rgmyay@2`} type="primary" onClick={() => this.handleImportHistory()}>{i18n.button.importHistoryQuery()}</Button>),
      (<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@ik37w2@3`} />),
    ]

    const btn6 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ndxpv2@1`} type="primary" onClick={() => this.handleSubmit('2')}>{i18n.button.submit()}</Button>),
      (<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@hhk2pn@2`} />),
    ]

    const btn7 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@xbwb60@1`} type="primary" onClick={() => hrmGroup.save('4')}>{i18n.button.save()}</Button>),
      (<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@7puhv9@2`} />),
    ]

    const btn8 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@m42zpn@1`} type="primary" disabled={!logFilePath ? true : false}><a href={'/api/hrm/group/getImportHistoryFile?filename=' + logFilePath}>{getLabel('386493',"导入日志下载")}</a></Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@m2d16n@2`} disabled >更多 >></Button>),
    ]

    const btn9 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@i48lao@1`} disabled >更多 >></Button>),
    ]

    const btn10 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@3zwnyc@1`} disabled >更多 >></Button>),
    ]

    const btn11 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@j4qzs4@1`} disabled >更多 >></Button>),
    ]

    const btn12 = [
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@uy0181@1`} type="primary" onClick={() => this.handleSearch('3')}>{i18n.button.search()}</Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@4t29nv@2`} type="primary" onClick={() => form7.reset()}>{i18n.button.reset()}</Button>),
      (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@hmzqw1@3`} type="primary" onClick={() => hrmGroup.setPanelThreeStatus(false)}>{i18n.button.cancel()}</Button>),
    ]

    return (
      <div>
  				<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@wf0heg`} datas={dropMenuDatas1} onClick={this.handleOneDropMenuClick}>
  					{ true ? (<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@g4genf`} 
              title={getLabel('18166',"个性化设置")}
              icon={<i className='icon-coms-hrm' />}
              iconBgcolor='#217346'
              loading={true}
            />) : ''}
            <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@upgqjt`}
                  		searchType={['base','advanced']}
                  		showSearchAd={isPanelOneShow}
                  		searchsBaseValue={searchsBaseValue1}
                  		setShowSearchAd={hrmGroup.setPanelOneStatus} 
                  		hideSearchAd={ () => hrmGroup.setPanelOneStatus(false) }
                  		searchsAd= {this.getPanelComponents(condition1, form1, '1')}
                  		advanceHeight={74}
                  		buttonsAd={btn1}
                      buttons={this.getCustomComponent('1')}
                  		onSearch={() => hrmGroup.getTableInfo('1')}
                  		onSearchChange={val => hrmGroup.updateFormFields('1', val)}
                	/>
                	 {this.getTable(tbParams1)}
  				</WeaRightMenu>

  				<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@vy9mmy`}
            		title={getLabel('126253',"公共组调整建议")}
            		icon="icon-coms-hrm"
            		iconBgcolor="#217346"
            		visible={isSuggestDialogShow}
            		closable={true}
            		onCancel={() => {hrmGroup.setSuggestDialogStatus(false); hrmGroup.setPanelThreeStatus(false)}}
            		buttons={btn11}
            		style={{width: 890, height: 510}}
            		onChangeHeight={hrmGroup.changeHeight}
          		> 
            		<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@optbzg`}
                    	selectedKey={suggestTabKey}
                    	datas={tabName.slice(3, 5)}
                    	keyParam='key'
                    	searchsBaseValue={searchsBaseValue3}
                    	onChange={hrmGroup.suggestTabClick}
                    	searchType={['base','advanced']}
                    	setShowSearchAd={hrmGroup.setPanelThreeStatus}
                    	hideSearchAd={ () => hrmGroup.setPanelThreeStatus(false) }
                    	showSearchAd={isPanelThreeShow}
                    	searchsAd= {this.getPanelComponents(condition7, form7, '3')}
                    	advanceHeight={120}
                    	buttonsAd={btn12}
                    	onSearch={ () => hrmGroup.getTableInfo('7') }
                    	onSearchChange={val => hrmGroup.updateFormFields('5', val)}
                  	/>
                  	<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@qa5ztw`} datas={dropMenuDatas6} onClick={this.handleSixDropMenuClick}>
                   		{this.getTable(tbParams4)}
                   	</WeaRightMenu>
          		</WeaDialog>

  				<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@dnhwxd`}
            		title={getLabel('125445',"常用组信息导入")}
            		icon="icon-coms-hrm"
            		iconBgcolor="#217346"
            		visible={isImportBaseDialogShow}
            		closable={true}
            		onCancel={() => hrmGroup.setImportBaseDialogStatus(false)}
            		buttons={btn5}
            		style={{width: 870, height: 510}}
          		> 
            		<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@bjsw3j`} datas={dropMenuDatas3} onClick={this.handleThreeDropMenuClick}>
          				<div className='hrm-group-form'>
          					{this.getImportComponents(condition4, form4, '1')}	
          				</div>
          			</WeaRightMenu>
          		</WeaDialog>

          		<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@57xnq6`}
            		title={getLabel('125445',"常用组信息导入")}
            		icon="icon-coms-hrm"
            		iconBgcolor="#217346"
            		visible={isImportInfoDialogShow}
            		closable={true}
            		onCancel={() => hrmGroup.setImportInfoDialogStatus(false)}
            		buttons={btn8}
            		style={{width: 700, height: 510}} 
                onChangeHeight={hrmGroup.changeHeight}
          		> 
          			<div className='hrm-group-table hrm-group-form'>
          				<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@b9pr9y`} needTigger={false} title={getLabel('386987',"导入情况")} showGroup={true} fontSize={13}>
          					{this.getAntTable(paramsForAntTable, true)}
          				</WeaSearchGroup>
          			</div>
          		</WeaDialog>

          		<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@r4k6ep`}
            		title={getLabel('24644',"历史导入记录")}
            		icon="icon-coms-hrm"
            		iconBgcolor="#217346"
            		visible={isImportHistoryDialogShow}
            		closable={true}
            		onCancel={() => hrmGroup.setImportHistoryDialogStatus(false)}
            		buttons={btn9}
            		style={{width: 750, height: 510}} 
                onChangeHeight={hrmGroup.changeHeight}
          		> 
          			{ hasAuthority ? this.getAntTable(paramsForAntTable, false) : this.getAuthorityIcon()}
          		</WeaDialog>

          		<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@u6ghym`}
            		title={getLabel('386494',"导入成员")}
            		icon="icon-coms-hrm"
            		iconBgcolor="#217346"
            		visible={isImportMemberDialogShow}
            		closable={true}
            		onCancel={() => hrmGroup.setImportMemberDialogStatus(false)}
            		buttons={btn6}
            		style={{width: 650, height: 430}}
          		> 
            		<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@goebak`} datas={dropMenuDatas4} onClick={this.handleFourDropMenuClick}>
          				<div className='hrm-group-form'>
          					{this.getImportComponents(condition5, form5, '2')}	
          				</div>
          			</WeaRightMenu>
          		</WeaDialog>

          		<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@rirbhx`}
            		title={getLabel('386495',"常用组人员导入")}
            		icon="icon-coms-hrm"
            		iconBgcolor="#217346"
            		visible={isImportMemInfoDialogShow}
            		closable={true}
            		onCancel={() => hrmGroup.setImportMemInfoDialogStatus(false)}
            		buttons={btn10}
            		style={{width: 700, height: 510}} 
                onChangeHeight={hrmGroup.changeHeight}
          		> 
          			<div className='hrm-group-table hrm-group-form'>
          				<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@8fzpv0`} needTigger={false} title={getLabel('386987',"导入情况")} showGroup={true} fontSize={13}>
          						{this.getAntTable(paramsForAntTable, true)}
          				</WeaSearchGroup>
          			</div>
          		</WeaDialog>

  				<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@cbrj70`}
            		title={getLabel('386496',"新建常用组")}
            		icon="icon-coms-hrm"
            		iconBgcolor="#217346"
            		visible={isNewDialogShow}
            		closable={true}
            		onCancel={() => hrmGroup.setNewDialogStatus(false)}
            		buttons={btn2}
            		style={{width: 650}} 
          		> 
            		<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@hdo5kn`} datas={dropMenuDatas2} onClick={this.handleTwoDropMenuClick}>
          				{this.getNewAndShareComponents(condition3, form3, false)}	
          			</WeaRightMenu>
          		</WeaDialog>

              
          		<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@79xnwh`}
            		title={getLabel('126252',"常用组设置")}
            		icon="icon-coms-hrm"
            		iconBgcolor="#217346"
            		visible={isEditDialogShow}
            		closable={true}
            		onCancel={() => {hrmGroup.setEditDialogStatus(false); hrmGroup.setPanelTwoStatus(false); hrmGroup.tabReset()}}
            		buttons={btn3}
            		style={{width: 780, height: 510}}
            		onChangeHeight={hrmGroup.changeHeight}
          		>
              <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@uuinzp`} datas={datas} onClick={this.handleDropMenuClick}>
                  <div className='hrm-group-tab'>
          			    <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@y9bl7b`}
                    	selectedKey={editTabKey}
                    	datas={type == '0' ? tabName.slice(0, 2) : tabName.slice(0, 3)}
                    	keyParam='key'
                    	searchsBaseValue={searchsBaseValue2}
                    	onChange={hrmGroup.tabClick}
                    	searchType={ (editTabKey == '1') ? ['base','advanced'] : ''}
                    	setShowSearchAd={hrmGroup.setPanelTwoStatus}
                    	hideSearchAd={ () => hrmGroup.setPanelTwoStatus(false) }
                    	showSearchAd={isPanelTwoShow}
                    	searchsAd= { (editTabKey == '1') ? this.getPanelComponents(condition2, form2, '2') : []}
                    	advanceHeight={120}
                    	buttonsAd={btn4}
                      buttons={this.getGroupSettingBtns(editTabKey)}
                    	onSearch={ () => hrmGroup.getTableInfo('2') }
                    	onSearchChange={val => hrmGroup.updateFormFields('2', val)}
                  	/>
                  </div>
                  	<div className='hrm-resource-edit-content' style={ (editTabKey == '0') ? {display: 'block'} : {display: 'none'}}>
                        {this.getNewAndShareComponents(condition3, form3, false)}
                  	</div>
                  	<div style={ (editTabKey == '1') ? {display: 'block'} : {display: 'none'}} className='hrm-group-weatable'>
                   		   {this.getTable(tbParams2)}
                  	</div>
                  	<div style={ (editTabKey == '2') ? {display: 'block'} : {display: 'none'}}>
                        {this.getTable(tbParams3)}
                  	</div>
                  </WeaRightMenu>
          		</WeaDialog>
              
          		<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@39r4ru`}
            		title={getLabel('18645',"添加共享")}
            		icon="icon-coms-hrm"
            		iconBgcolor="#217346"
            		visible={isShareDialogShow}
            		closable={true}
            		onCancel={() => hrmGroup.setShareDialogStatus(false)}
            		buttons={btn7}   
            		style={{width: 700, height: 250}} 
          		>
            	<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@hpg1hp`} datas={dropMenuDatas5} onClick={this.handleFiveDropMenuClick}>
            	  {this.getNewAndShareComponents(condition6, form6, true)}
            	</WeaRightMenu>
          </WeaDialog>
          	
  			</div>
    )

  }
}

Group = Form.create({})(Group);

export default Group